package com.kuhnwei.examples.patterns.factory;

/**
 * Created by Kuhn on 2017/8/5.
 */
public class Factory {

    public static Fruit getInstance(String className) {
        if ("apple".equalsIgnoreCase(className)) {
            return new Apple();
        } else if ("cherry".equalsIgnoreCase(className)) {
            return new Cherry();
        } else {
            return null;
        }
    }

}
